package com.resign.carl.singleton.impl;

/**
 * 单例模式 -- 懒汉模式
 * Created by carl.zhao on 2016/6/14.
 */
public class LazySingleton {
    private static volatile LazySingleton instance = null;

    private LazySingleton(){}

    public static LazySingleton getInstance(){
        if(null == instance){
            synchronized (LazySingleton.class){
                if(null == instance){
                    instance = new LazySingleton();
                    return instance;
                }
            }
        }
        return instance;
    }
}
